﻿using System.IO;
using System.Windows;
using WpfApp2.model;

namespace WpfApp4
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            //string dbPath = "mydatabase.db"; // 定义数据库文件路径

            //// 检查文件是否存在，如果存在则删除
            //if (File.Exists(dbPath))
            //{
            //    //File.Delete(dbPath);
            //}
            using (var qcsConfigDbContext = new QcsConfigDbContext())
            {
                qcsConfigDbContext.Database.EnsureCreated();
            }

            using (var schoolDbContext = new SchoolDbContext())
            {
                schoolDbContext.Database.EnsureCreated();
            }
        }
    }
}